$(function() {

    $("#submit-btn").on("click",function() {
        var $account = $("#account").val();
        var $password = $("#password").val();
        var $fileImg = $("#fileImg").val();


        // if ($userName == "") {
        //     alert("用户名不能为空!");
        //     return;
        // }
        //
        // if ($password == "") {
        //     alert("用户名不能为空!");
        //     return;
        // }

        $.ajax({
            "type": "post",
            "url": "register",
            "data":{"userName":$account,"password":$password,"fileImg":$fileImg},
            "success" : function(resp) {
                if (resp.code == 200) {
                    alert("注册成功！");
                    // window.location.href = resp.obj;
                } else {
                    alert(resp.msg);
                    return;
                }
            }
        });
    });

    $(document).on("keydown",function(e) {
        if (e.keyCode == 13) {
            $("#submit-btn").trigger("click");
        }
    });

});